package org.smile.homework03.arthas.custom;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Application {
    public static void main(String[] args) {
        Goods tire = new Goods();
        tire.add(new GoodsItem("g1"));
        tire.add(new GoodsItem("g2"));
        tire.add(new GoodsItem("g3"));
        tire.add(new GoodsItem("g4"));
        tire.add(new GoodsItem("g5"));

        Goods engine = new Goods();
        engine.add(new GoodsItem("e1"));
        engine.add(new GoodsItem("e2"));
        engine.add(new GoodsItem("e3"));
        engine.add(new GoodsItem("e4"));
        engine.add(new GoodsItem("e5"));

        List<Goods> goods = new ArrayList<>();
        goods.add(tire);
        goods.add(engine);
        Iterator iterator = goods.iterator();
        iterator.hasNext();
        iterator.next();
        iterator.remove();

//        while (iterator.hasNext()){
//            Goods goods1 = (Goods)iterator.next();
//            iterator.remove();
//        }
        System.out.println(goods.size());

        for (Goods goods1 : goods){
            ZHLIterator zhlIterator = goods1.getZIterator();
            while (zhlIterator.hasNext()) {
                GoodsItem goodsItem = (GoodsItem) zhlIterator.next();
                System.out.println(goodsItem.getName());
            }
        }

    }
}
